Loop over Signatures Configuration

Hi to All

How can I obtain the signatories defined in a module, each SigEntry in a SigInfo?

As I read in the manual I can do by the iterator "void ::do(SignatureEntry &, SignatureInfo sigInfo, void )" by I dont't know how to do it.

Thanks.
jpruizmoyano - Wed Apr 14 12:00:10 EDT 2010

Re: Loop over Signatures Configuration
Mathias Mamsch - Wed Apr 14 12:14:26 EDT 2010

Yeah, they obviously did not put a lot of work in that help part.

::do (TypeA& varA, TypeB varB, void) is actually a function that will be called when you do a "for varA in varB do ...". So taking what I see from the help and the perms list, I would try something like this (never uses Signatures myself before):
 

SignatureInfo sigInfo 
ModName_ mn = module "/MyModule"
int imajor = 1
int iminor = 2
string sSuffix = "a"
 
print "getting Siginfo:" getSignatureInfo (sigInfo, mn, imajor, iminor, sSuffix) 
 
SignatureEntry e 
 
for e in sigInfo do { 
   // ...
}


Regards, Mathias

Re: Loop over Signatures Configuration
SystemAdmin - Wed Apr 14 12:32:50 EDT 2010

DXL Help has this kind of example, would this work?
 

// Signatures example code : list signatures in the latest baseline 
// of the current module 
if (null current Module) 
{ 
    warningBox "Must run from an open module." 
    halt 
} 
Baseline b = getMostRecentBaseline(current Module) 
if (null b || (null load(b,true))) 
{ 
    warningBox "No baseline available" 
    halt 
} 
string dummy[] = {} 
DB signaturesDB = create("Baseline Signatures Example",styleFixed) 
SignatureInfo signatureInfo = null 
DBE timeCombo, sigListView, commentText 
DBE labelLabel, labelList, closeBtn 
string timeChoices[] = {"signatory's","current"} 
DBE timeLabel  
static int SIGNATORY_COL = 0 
static int DATE_COL = 1 
static int LABEL_COL = 2 
//************************************************************ 
void listSignature(SignatureEntry sigEntry, int i, bool localTimes) 
// DESCRIPTION : adds an entry in the listView for a given signatureEntry 
// RETURNS : void 
{ 
    insert(sigListView,i,getUserName(sigEntry),null,iconUser) 
    if (localTimes) 
    { 
        set(sigListView,i,DATE_COL,(dateOf intOf getLocalDate(sigEntry)) "") 
    } 
    else 
    { 
        set(sigListView,i,DATE_COL,(dateOf intOf getDate(sigEntry)) "") 
    } 
    set(sigListView,i,LABEL_COL,getLabel(sigEntry)) 
} 
//**************************************************************************** 
void refreshListView(void) 
// DESCRIPTION : Populates sigListView with the info in signatureInfo 
// RETURNS : void 
// ERROR CONDITIONS : null signatureInfo - returns without any action 
{ 
    if (null signatureInfo) 
    { 
        return 
    } 
     
    int i = get(timeCombo) 
    bool localTimes = (i == 0) 
    int entryNumber 
    empty sigListView 
    entryNumber = 0 
    SignatureEntry sigEntry 
    for sigEntry in signatureInfo do 
    { 
        listSignature(sigEntry,entryNumber,localTimes) 
        entryNumber++ 
    }  
} // void refreshListView(void) 
//**************************************************************************** 
void closeDB(DB x) 
// DESCRIPTION : close function for the signature dialog. Hides it. 
// RETURNS : void 
{ 
    hide signaturesDB 
    halt 
} 
//************************************************************ 
void closeDB(DBE x) 
// DESCRIPTION : close function for the signature dialog. Hides it. 
// RETURNS : void 
{ 
    closeDB(signaturesDB) 
} 
//************************************************************ 
void refreshSigsDB() 
// DESCRIPTION : refreshes the signatures list with the signature info from 
//               the database, in the specified baseline. 
// RETURNS : void 
{ 
    ModName_ thisModule = module (fullName current Module) 
        string message = getSignatureInfo(signatureInfo, thisModule, major(b), 
minor(b), suffix(b)) 
        set(commentText,"") 
        set(labelList,"") 
        if (!null message) 
        { 
            warningBox(signaturesDB,"Cannot display signatures for this baseline: 
" message "\nThe baseline signature dialogue will be closed.") 
            closeDB(signaturesDB) 
        } 
        else 
        { 
            refreshListView() 
        } 
} // refreshSigsDB 
//************************************************************ 
void timeComboCB(DBE x) 
// DESCRIPTION : Callback for the time-zone selection combo 
// RETURNS : void 
{ 
    refreshListView() 
} 
//************************************************************ 
void sigDeselectCB(DBE x, int selectedEntry) 
// DESCRIPTION : Deselect callback for listView - null-op. 
// RETURNS : void 
{ 
} 
//************************************************************ 
void sigSelectCB(DBE x, int selectedEntry) 
// DESCRIPTION : Selection callback for signatures list 
// RETURNS : void 
{ 
    int indexScan = 0 
    SignatureEntry sigEntry 
    for sigEntry in signatureInfo do 
    { 
        if (indexScan == selectedEntry) 
        { 
            set(commentText,getComment(sigEntry)) 
            set(labelList,getLabelOptions(sigEntry)) 
            break 
        } 
        indexScan++ 
    }  
} // sigSelectCB 
// DEFINE MAIN DIALOG 
sigListView = listView(signaturesDB,0,405,8,dummy) 
set(sigListView,sigSelectCB,sigDeselectCB,sigSelectCB) 
timeCombo=choice(signaturesDB,"Display time at",timeChoices,0,9,false) 
set(timeCombo,timeComboCB) 
beside signaturesDB 
timeLabel = label(signaturesDB,"location.") 
below signaturesDB 
commentText = text(signaturesDB,"Comments:","",100,100,true) 
labelList = text(signaturesDB,"Available labels:","",160,100,true) 
// BUTTONS 
close(signaturesDB,true,closeDB) 
realize signaturesDB 
insertColumn(sigListView,SIGNATORY_COL,"Signatory",150,iconNone) 
insertColumn(sigListView,DATE_COL,"Date / Time",150,iconNone) 
insertColumn(sigListView,LABEL_COL,"Label",100,iconNone) 
refreshSigsDB() 
show signaturesDB

Re: Loop over Signatures Configuration
jpruizmoyano - Tue May 11 05:22:18 EDT 2010

Mathias Mamsch - Wed Apr 14 12:14:26 EDT 2010

Yeah, they obviously did not put a lot of work in that help part.

::do (TypeA& varA, TypeB varB, void) is actually a function that will be called when you do a "for varA in varB do ...". So taking what I see from the help and the perms list, I would try something like this (never uses Signatures myself before):
 

SignatureInfo sigInfo 
ModName_ mn = module "/MyModule"
int imajor = 1
int iminor = 2
string sSuffix = "a"
 
print "getting Siginfo:" getSignatureInfo (sigInfo, mn, imajor, iminor, sSuffix) 
 
SignatureEntry e 
 
for e in sigInfo do { 
   // ...
}


Regards, Mathias

Thank you Mathias. I understand it.

Re: Loop over Signatures Configuration
jpruizmoyano - Tue May 11 05:23:29 EDT 2010

SystemAdmin - Wed Apr 14 12:32:50 EDT 2010

DXL Help has this kind of example, would this work?
 

// Signatures example code : list signatures in the latest baseline 
// of the current module 
if (null current Module) 
{ 
    warningBox "Must run from an open module." 
    halt 
} 
Baseline b = getMostRecentBaseline(current Module) 
if (null b || (null load(b,true))) 
{ 
    warningBox "No baseline available" 
    halt 
} 
string dummy[] = {} 
DB signaturesDB = create("Baseline Signatures Example",styleFixed) 
SignatureInfo signatureInfo = null 
DBE timeCombo, sigListView, commentText 
DBE labelLabel, labelList, closeBtn 
string timeChoices[] = {"signatory's","current"} 
DBE timeLabel  
static int SIGNATORY_COL = 0 
static int DATE_COL = 1 
static int LABEL_COL = 2 
//************************************************************ 
void listSignature(SignatureEntry sigEntry, int i, bool localTimes) 
// DESCRIPTION : adds an entry in the listView for a given signatureEntry 
// RETURNS : void 
{ 
    insert(sigListView,i,getUserName(sigEntry),null,iconUser) 
    if (localTimes) 
    { 
        set(sigListView,i,DATE_COL,(dateOf intOf getLocalDate(sigEntry)) "") 
    } 
    else 
    { 
        set(sigListView,i,DATE_COL,(dateOf intOf getDate(sigEntry)) "") 
    } 
    set(sigListView,i,LABEL_COL,getLabel(sigEntry)) 
} 
//**************************************************************************** 
void refreshListView(void) 
// DESCRIPTION : Populates sigListView with the info in signatureInfo 
// RETURNS : void 
// ERROR CONDITIONS : null signatureInfo - returns without any action 
{ 
    if (null signatureInfo) 
    { 
        return 
    } 
     
    int i = get(timeCombo) 
    bool localTimes = (i == 0) 
    int entryNumber 
    empty sigListView 
    entryNumber = 0 
    SignatureEntry sigEntry 
    for sigEntry in signatureInfo do 
    { 
        listSignature(sigEntry,entryNumber,localTimes) 
        entryNumber++ 
    }  
} // void refreshListView(void) 
//**************************************************************************** 
void closeDB(DB x) 
// DESCRIPTION : close function for the signature dialog. Hides it. 
// RETURNS : void 
{ 
    hide signaturesDB 
    halt 
} 
//************************************************************ 
void closeDB(DBE x) 
// DESCRIPTION : close function for the signature dialog. Hides it. 
// RETURNS : void 
{ 
    closeDB(signaturesDB) 
} 
//************************************************************ 
void refreshSigsDB() 
// DESCRIPTION : refreshes the signatures list with the signature info from 
//               the database, in the specified baseline. 
// RETURNS : void 
{ 
    ModName_ thisModule = module (fullName current Module) 
        string message = getSignatureInfo(signatureInfo, thisModule, major(b), 
minor(b), suffix(b)) 
        set(commentText,"") 
        set(labelList,"") 
        if (!null message) 
        { 
            warningBox(signaturesDB,"Cannot display signatures for this baseline: 
" message "\nThe baseline signature dialogue will be closed.") 
            closeDB(signaturesDB) 
        } 
        else 
        { 
            refreshListView() 
        } 
} // refreshSigsDB 
//************************************************************ 
void timeComboCB(DBE x) 
// DESCRIPTION : Callback for the time-zone selection combo 
// RETURNS : void 
{ 
    refreshListView() 
} 
//************************************************************ 
void sigDeselectCB(DBE x, int selectedEntry) 
// DESCRIPTION : Deselect callback for listView - null-op. 
// RETURNS : void 
{ 
} 
//************************************************************ 
void sigSelectCB(DBE x, int selectedEntry) 
// DESCRIPTION : Selection callback for signatures list 
// RETURNS : void 
{ 
    int indexScan = 0 
    SignatureEntry sigEntry 
    for sigEntry in signatureInfo do 
    { 
        if (indexScan == selectedEntry) 
        { 
            set(commentText,getComment(sigEntry)) 
            set(labelList,getLabelOptions(sigEntry)) 
            break 
        } 
        indexScan++ 
    }  
} // sigSelectCB 
// DEFINE MAIN DIALOG 
sigListView = listView(signaturesDB,0,405,8,dummy) 
set(sigListView,sigSelectCB,sigDeselectCB,sigSelectCB) 
timeCombo=choice(signaturesDB,"Display time at",timeChoices,0,9,false) 
set(timeCombo,timeComboCB) 
beside signaturesDB 
timeLabel = label(signaturesDB,"location.") 
below signaturesDB 
commentText = text(signaturesDB,"Comments:","",100,100,true) 
labelList = text(signaturesDB,"Available labels:","",160,100,true) 
// BUTTONS 
close(signaturesDB,true,closeDB) 
realize signaturesDB 
insertColumn(sigListView,SIGNATORY_COL,"Signatory",150,iconNone) 
insertColumn(sigListView,DATE_COL,"Date / Time",150,iconNone) 
insertColumn(sigListView,LABEL_COL,"Label",100,iconNone) 
refreshSigsDB() 
show signaturesDB

Thank you Pekka. I also found this example in DXL Help. It's enough.